﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AdminSendEmail.aspx.cs" Inherits="BalanceCenter_AdminSendEmail" %>

<%@ Register Assembly="Shove.Web.UI.4 For.NET 2.0" Namespace="Shove.Web.UI" TagPrefix="ShoveWebUI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>发送电子邮件</title>
    <link href="../Style/css.css" rel="stylesheet" type="text/css" />
    <link href="../Style/main.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/jscript">
	    function CheckAll(form)
        {
            for (var i=0;i<form.elements.length;i++)
            {
                var e = form.elements[i];
                if (e.type == "checkbox")
                e.checked = form.chkAll.checked;
            }
        }
        function checkAddSMS(form)
        {
            var bln = false;
            for(i=0; i<form.elements.length; i++)
            {
                var e = form.elements[i];
                if (e.type == "checkbox" && e.checked && e.name != "chkAll")
                {
                    bln = true;
                    break;
                }
             }
             
            if (bln)
            {
                if (confirm('确定要将选定的客户加入到短信营销吗?'))
                {
                    return true;
                }
                else
                {
                    for (var i=0;i<form.elements.length;i++)
                    {
                        var e = form.elements[i];
                        if (e.type == "checkbox")
                        e.checked = false;
                    }

                    return false;
                }
            }
            else
            {
                alert('请选择您要操作的客户');
                for (var i=0;i<form.elements.length;i++)
                {
                    var e = form.elements[i];
                    if (e.type == "checkbox")
                    e.checked = false;
                }

                return;
            }
        }
        
        function checkAddEMail(form)
        {
            var bln = false;
            for(i=0; i<form.elements.length; i++)
            {
                var e = form.elements[i];
                if (e.type == "checkbox" && e.checked && e.name != "chkAll")
                {
                    bln = true;
                    break;
                }
             }
             
            if (bln)
            {
                if (confirm('确定要选定的客户加入到邮件群发吗?'))
                {
                    return true;
                }
                else
                {
                    for (var i=0;i<form.elements.length;i++)
                    {
                        var e = form.elements[i];
                        if (e.type == "checkbox")
                        e.checked = false;
                    }

                    return false;
                }
            }
            else
            {
                alert('请选择您要操作的客户');
                for (var i=0;i<form.elements.length;i++)
                {
                    var e = form.elements[i];
                    if (e.type == "checkbox")
                    e.checked = false;
                }

                return;
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="Panel1" runat="server" Visible="false" Width="98%">
            <table id="Table1" cellspacing="0" cellpadding="0" width="98%" border="0" align="center">
                <tr>
                    <td style="height: 50px; text-align: center;" colspan="2" align="center">
                        <span style="font-size: 12pt; color: #3399cc"><strong>发送电子邮件</strong></span>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <asp:DataGrid ID="g" runat="server" BackColor="#6CA4E4" CellPadding="5" Width="100%"
                            CellSpacing="1" BorderWidth="0px" AllowSorting="True" AutoGenerateColumns="False"
                            AllowPaging="True" CssClass="gStyle" OnItemDataBound="g_ItemDataBound">
                            <FooterStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
                            <SelectedItemStyle HorizontalAlign="Center" Font-Bold="True" ForeColor="White"></SelectedItemStyle>
                            <HeaderStyle HorizontalAlign="Center" ForeColor="Navy" VerticalAlign="Middle" CssClass="gHeader">
                            </HeaderStyle>
                            <ItemStyle CssClass="gItem" BackColor="White" />
                            <Columns>
                                <asp:TemplateColumn HeaderText="选择">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkCompany" runat="server"></asp:CheckBox>
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:HyperLinkColumn DataNavigateUrlField="id" DataNavigateUrlFormatString="AdminUserEdit.aspx?id={0}"
                                    DataTextField="CustomerNo" HeaderText="用户名"></asp:HyperLinkColumn>
                                <asp:BoundColumn DataField="CustomerName" SortExpression="RealityName" HeaderText="真实姓名">
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="Sex" SortExpression="Sex" HeaderText="性别"></asp:BoundColumn>
                                <asp:BoundColumn DataField="CertNo" SortExpression="CertNo" HeaderText="身份证"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Address" SortExpression="Address" HeaderText="地址"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Email" SortExpression="Email" HeaderText="邮箱"></asp:BoundColumn>
                                <asp:BoundColumn DataField="QQ" SortExpression="QQ" HeaderText="QQ"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Tel" SortExpression="Tel" HeaderText="电话"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Tel" SortExpression="Tel" HeaderText="手机"></asp:BoundColumn>
                                <asp:BoundColumn HeaderText="类别" DataField="CustomerTypeName" SortExpression="CustomerTypeName">
                                </asp:BoundColumn>
                                <asp:BoundColumn Visible="False" DataField="id"></asp:BoundColumn>
                                <asp:BoundColumn Visible="False" DataField="CustomerTypeID"></asp:BoundColumn>
                            </Columns>
                            <PagerStyle Visible="False" />
                        </asp:DataGrid>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="left" style="padding-left: 5px; height: 21px;">
                                    全选 &nbsp;<input id="chkAll" onclick="javascript: CheckAll(this.form);" type="checkbox"
                                        value="checkbox" name="chkAll">
                                    &nbsp;<input type="button" id="bt_AddEMail" runat="server" onclick="javascript: checkAddEMail(this.form);"
                                        value="发送邮件" onserverclick="bt_AddEMail_ServerClick" />
                                    &nbsp;<input type="button" id="bt_AllUserEMail" runat="server" value="给所有用户邮件" onserverclick="bt_AllUserEMail_ServerClick" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="left" style="padding-left: 3px; vertical-align: middle;">
                    </td>
                    <td style="padding-left: 3px; vertical-align: middle;">
                        <ShoveWebUI:ShoveGridPager ID="gPager" BorderWidth="0" CssClass="gStyle" BorderStyle="None"
                            runat="server" Width="100%" ShowSelectColumn="False" DataGrid="g" OnPageWillChange="gPager_PageWillChange"
                            OnSortBefore="gPager_SortBefore" AlternatingRowColor="White" HotColor="White"
                            GuiseColor="False" ClientNavigation="true" PageSize="10" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" Visible="false" Width="98%">
            <br />
            <br />
            <br />
            <table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#666666">
                <tr>
                    <td height="25" align="center" bgcolor="#ffffff">
                        选中的用户
                    </td>
                    <td colspan="3" align="left" bgcolor="#ffffff" style="padding-left: 3px;">
                        <asp:TextBox ID="tbSendEmailUser" runat="server" Width="426px" Height="39px" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td height="25" align="center" bgcolor="#ffffff">
                        标题
                    </td>
                    <td colspan="3" align="left" bgcolor="#ffffff" style="padding-left: 3px;">
                        <asp:TextBox ID="tbTitle" runat="server" Width="419px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td height="25" align="center" bgcolor="#ffffff" valign="top">
                        内容
                    </td>
                    <td colspan="3" align="left" bgcolor="#ffffff" style="padding-left: 3px;">
                        <asp:TextBox ID="tbSendEmailContent" runat="server" Width="426px" Height="154px"
                            TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center" bgcolor="#ffffff" height="26">
                        <asp:Button ID="btnSendEmail" runat="server" BackColor="White" BorderStyle="None"
                            Height="22px" Style="background-image: url(../Images/btnBack06.gif); cursor: hand"
                            Text="立即发送" Width="65px" OnClick="btnSendEmail_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
